﻿@model IFDB.ViewModels.PageViewModels.MatchViewModel

@{
    ViewBag.Title = "Index";
}

<div class="clear"></div>
<div class="grid_7">
    <table class="AppearanceTable">
        <thead>
            <tr>
                <th class="LeftTeam">
                    @Html.ActionLink(Model.Match.Team1.TeamName, "Index", "Team", new { teamId = Model.Match.Team1.TeamId }, null)
                </th>
                <th class="Score">
                    @Html.DisplayFor(m => Model.Match.Team1FT)
                    @Html.Raw(" - ")
                    @Html.DisplayFor(m => Model.Match.Team2FT)
                </th>
                <th class="RightTeam">
                    @Html.ActionLink(Model.Match.Team2.TeamName, "Index", "Team", new { teamId = Model.Match.Team2.TeamId }, null)
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td style="vertical-align: top">
                    @Html.Partial("~/Views/Shared/Match/_AppearanceListLeft.cshtml", Model.Team1Persons)
                </td>
                <td />
                <td style="text-align: left; vertical-align: top">
                    @Html.Partial("~/Views/Shared/Match/_AppearanceListRight.cshtml", Model.Team2Persons)
                </td>
            </tr>
        </tbody>
    </table>
</div>

<div class="grid_5">
    <table>
        <tbody>
            <tr>
                <td style="padding-right: 10px;">Competition:</td>
                <td>@Model.Match.Competition.CompetitionName</td>
            </tr>
            <tr>
                <td style="padding-right: 10px;">Date:</td>
                <td>@string.Format("{0} {1}", Model.GetDayPrefix(Model.Match.MatchDate), Model.Match.MatchDate.ToString("MMMM yyyy h:mm tt"))</td>
            </tr>
            
            @if (Model.Match.Venue != null)
            {
                <tr>
                    <td style="padding-right: 10px;">Venue:</td>
                    <td>@Html.DisplayFor(v => Model.Match.Venue.VenueName)</td>
                </tr>
            }
            
            @if (Model.Match.Attendance != null)
            {
                <tr>
                    <td style="padding-right: 10px;">Attendance:</td>
                    <td>@string.Format("{0: 0,0}", Model.Match.Attendance)</td>
                </tr>
            }
        </tbody>
    </table>

    @using (var t = Html.JQueryUI().BeginTabs())
    {
        t.Tab("Day's matches", "daysMatches");
        t.Tab("Head to head", "headToHead");

        using (t.BeginPanel())
        {
            @Html.Partial("~/Views/Shared/Match/_DaysMatches.cshtml", Model.DaysMatchesViewModel)
        }
        
        using (t.BeginPanel())
        {
            @Html.Partial("~/Views/Shared/Match/_HeadToHeadList.cshtml", Model.HeadToHeadViewModel)
        }
    }
</div>